﻿using iTextSharp.text.pdf;

namespace WebMvcDemo
{
    /// <summary>
    /// iText中文字体
    /// </summary>
    public static class ItextChinaFont
    {
        public static BaseFont ChinaFont { get; private set; }

        static ItextChinaFont()
        {
            //加载字体资源文件方案，需要把字体文件复制运行目录下，设置文件属性为如果较新则复制
            string fontPath = Path.Combine(AppContext.BaseDirectory, "DroidSansFallback.ttf");
            ChinaFont = BaseFont.CreateFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        }
    }
}
